// 测试AI服务器连接
async function testAIServer() {
    try {
        // 测试健康检查
        console.log("测试健康检查...");
        const healthResponse = await fetch("http://localhost:8000/health");
        const healthData = await healthResponse.json();
        console.log("健康检查结果:", healthData);

        // 测试聊天接口
        console.log("\n测试聊天接口...");
        const chatResponse = await fetch("http://localhost:8000/chat", {
            method: "POST",
            headers: {
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                message: "你好",
                type: "text",
            }),
        });
        const chatData = await chatResponse.json();
        console.log("聊天接口结果:", chatData);

        console.log("\n✅ AI服务器测试成功！");
    } catch (error) {
        console.error("❌ AI服务器测试失败:", error.message);
    }
}

testAIServer();
